home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / grafica / amhelios / calcsub.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  3KB  |  103 lines

  1. /* -------------------------------------------------------------------------- *\
  2.    CALCSUB.H
  3.    Copyright © 1997 by Jarno van der Linden
  4.    jarno@kcbbs.gen.nz
  5.  
  6.    Calculation subtask for AmHelios.
  7.    Header file
  8.  
  9.    This program is Freeware, and all usual Freeware rules apply.
  10.  
  11.    24 Aug 1997: Project started
  12. \* -------------------------------------------------------------------------- */
  13.  
  14. /* -------------------------------- Includes -------------------------------- */
  15. #include <exec/types.h>
  16.  
  17. #include <exec/ports.h>
  18.  
  19. #if (defined(_HEMI_CUBE) || defined(_CUBIC_TETRA))
  20. #include "prog_rad.h"
  21. #elif defined(_RAY_CAST)
  22. #include "ray_rad.h"
  23. #else
  24. #include "rad_eqn.h"
  25. #endif
  26.  
  27. /* ------------------------------ Definitions ------------------------------- */
  28.  
  29. /* --------------------------------- Macros --------------------------------- */
  30.  
  31. /* -------------------------------- Typedefs -------------------------------- */
  32.  
  33. /* -------------------------------- Structs --------------------------------- */
  34. class SubTask
  35. {
  36.     public:
  37.         SubTask(char *name);
  38.         virtual ~SubTask();
  39.  
  40.         void Start();
  41.         void Stop();
  42.         void Suspend();
  43.         void Resume();
  44.  
  45.     protected:
  46.         LONG SendSubTaskMsg(WORD command,APTR params);
  47.  
  48.         void KillSubTask();
  49.  
  50.         virtual void StartFunc() { ; };
  51.         virtual BOOL SubFunc() { return FALSE; };
  52.         virtual void StopFunc() { ; };
  53.  
  54.         virtual LONG HandleMessage(WORD command,APTR parameter) { return 0; };
  55.  
  56.     private:
  57.         struct SubTaskMsg
  58.         {
  59.             struct Message stm_Message;
  60.             WORD           stm_Command;
  61.             APTR           stm_Parameter;
  62.             LONG           stm_Result;
  63.         };
  64.  
  65.         void SpawnSubTask(char *name);
  66.         static void ExitSubTask(SubTask *thisst,struct SubTaskMsg *stm);
  67.         static SubTask *InitSubTask(void);
  68.         static void __asm __saveds Main(void);
  69.  
  70.     private:
  71.         struct Task      *task;    /* sub task pointer */
  72.         struct MsgPort   *port;    /* allocated by sub task */
  73.         struct MsgPort   *reply;   /* allocated by main task */
  74.         struct SubTaskMsg message; /* Message buffer */
  75. };
  76.  
  77.  
  78.  
  79. class CalcSub : public SubTask
  80. {
  81.     public:
  82.         CalcSub(char *name,RadEqnSolve *radiosity,Environ *env);
  83.         void Snapshot();
  84.     protected:
  85.         void StartFunc();
  86.         BOOL SubFunc();
  87.         void StopFunc();
  88.  
  89.         void SnapshotFunc();
  90.  
  91.         LONG HandleMessage(WORD command,APTR parameter);
  92.  
  93.     protected:
  94. #if (defined(_HEMI_CUBE) || defined(_CUBIC_TETRA))
  95.         ProgRad *radiosity;       // Progressive radiosity
  96. #elif defined(_RAY_CAST)
  97.         RayRad *radiosity;        // Ray cast radiosity
  98. #else
  99.         RadEqnSolve *radiosity;   // Dummy equation solver
  100. #endif
  101.         Environ *env;
  102. };
  103.